var a = getApp();

Page({
    data: {
        activeName: 0,
        list: [],
        amount: "",
        amount_finishi: "",
        amount_surplus: "",
        loading: !1,
        allLoaded: !1,
        goload: !0,
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(a) {
        this.getData(), this.getList();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.data.isLoadMore ? this.getMoreData(this.data.page) : console.log("没有更多数据");
    },
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.member-return.frontend.queue.index");
        a._getNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                1 === e.result ? t.setData({
                    amount: e.data.queue.amount,
                    amount_finishi: e.data.queue.amount_finish,
                    amount_surplus: e.data.queue.amount_surplus
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none"
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getList: function() {
        var t = this, e = a.getNetAddresss("plugin.member-return.frontend.log.get-list");
        e += "&page=" + this.data.page, a._getNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                1 === e.result ? t.setData({
                    list: e.data.data,
                    total_page: resdataresdata.data.last_page
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none"
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    gotoDetail: function(a) {
        var t = a.target.dataset.id || a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageB/member/enterprise/RecordOfAwards/RecordOfAwards?id=" + t
        });
    },
    getMoreData: function(t) {
        var e = this;
        if (this.data.page != this.data.total_page) if (this.data.page >= this.data.total_page) this.setData({
            loading: !0,
            allLoaded: !0
        }); else {
            var o = this.data.page + 1;
            this.setData({
                page: o
            });
            var n = a.getNetAddresss("plugin.member-return.frontend.log.get-list");
            n += "&page=" + this.data.page, a._getNetWork({
                url: n,
                success: function(a) {
                    var t = a.data;
                    if (1 === t.result) {
                        t.data = t.data.data;
                        var o = e.data.list.concat(t.data.data);
                        e.setData({
                            loading: !1,
                            allLoaded: !1,
                            list: o
                        });
                    } else {
                        wx.showToast({
                            title: t.msg,
                            icon: "none"
                        });
                        var n = e.data.page - 1;
                        e.setData({
                            page: n,
                            loading: !0,
                            allLoaded: !0,
                            isLoadMore: !1
                        });
                    }
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    }
});